package edu.zjut.hjg.saas.biz.dao.impl;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import edu.zjut.hjg.saas.biz.dao.RecipeDao;
import edu.zjut.hjg.saas.biz.model.Recipe;

public class RecipeDaoImpl extends SqlMapClientDaoSupport implements RecipeDao {

    @Override
    public Integer create(Recipe recipe) {
        return (Integer) getSqlMapClientTemplate().insert("recipe.create", recipe);
    }

    @Override
    public Recipe findByAppId(int appId) {
        return (Recipe) getSqlMapClientTemplate().queryForObject("recipe.findByAppId", appId);
    }

    @Override
    public Recipe load(Integer id) {
        return (Recipe) getSqlMapClientTemplate().queryForObject("recipe.load", id);
    }

    @Override
    public void update(Recipe recipe) {
        getSqlMapClientTemplate().update("recipe.update", recipe);
    }
}
